#include "stdio.h"
#include "fcntl.h"
#include "user.h"
#include <stdlib.h>
#define CONSOLE 1

int
main(void)
{

    int ret;

    struct stat_fs st;
    int test;

    if((ret=do_open("app_helloworld", O_RDWR)) < 0){
        printf("do_open fail call do_mknod\n");
        do_mknod("console", CONSOLE, 0);
    }
    printf("do_open ret = %d \n",ret);
	int a,b;
	if(ret >= 0)
	{
		a = dup(0); //stdout
		b = dup(0); //stderr
		printf("sysycall dup return %d %d succeccfully\n",a,b);
	}

    if((test = do_fstat(ret, &st)) < 0)
        printf("syscall fstat error\n");
    else
        printf("fstat test return %d succeccfully\n", test);

	return 0;
}
